<!-- $Id: editCat.html 110 2011-05-06 10:22:31Z nicholasinlove1986@gmail.com $ -->
<include file="Public:pageheader"/>
<load href="__PUBLIC__/Js/validator.js" />
<script language="javascript">
/**
* 根据分类名称转换编码
*/
$(function(){
	$('#select').change(function(){
		var t = $('#title').val();
		if(t=='') {
			alert('{$Think.lang.js_make_cat_name}');
		} else {
			 $.get("__URL__/ajaxCat", {
				 title : $('#title').val(),
				 cat : $(this).children('option:selected').val()
			 },function(data,textStatus) {
				 $('#category_url').val(data);
			 });
			//$('#category_url').val(encodeURIComponent($('#title').val()));
		}
	});
	
	$('#title').blur(function(){
		$.get("__URL__/ajaxCat", {
			 title : $('#title').val()
		},function(data,textStatus) {
			 $('#category_url').val(data);
		});
		//$('#category_url').val(encodeURIComponent($('#title').val()));
	});
});

/**
* 检查表单输入的数据
*/
function validate()
{
	validator = new Validator("theForm");
	validator.required("category_title","{$Think.lang.js_category_title}");
	validator.required("category_url","{$Think.lang.js_category_url}");
	validator.isNumber("category_sort","{$Think.lang.js_category_sort}");
	return validator.passed();
}
</script>
<!-- start add new category form -->
<div class="main-div">
  <form action="__URL__/updateCat" method="post" name="theForm" onsubmit="return validate();">
  <table width="100%">
      <tr>
        <td width="50%" class="label">{$Think.lang.category_title}:</td>
        <td width="50%">
          <input type='text' name='category_title' maxlength="20" size='17' id="title"  value="{$vo.category_title}"/><span class="require-field">*</span>
        </td>
      </tr>
      <tr>
        <td class="label">{$Think.lang.category_parent}:</td>
        <td>
          <select name="parent_id" id="select">
            <option value="0">{$Think.lang.category_top}</option>
            {$cat_option}
			</select>
        </td>
      </tr>
      <tr class="label">
        <td class="label"><a href="javascript:showNotice('url');" title="{$Think.lang.notic}"><img src="__PUBLIC__/Images/notice.gif" width="16" height="16" border="0"></a> {$Think.lang.category_url}:</td>
        <td><input type="text" size="40" name="category_url" id="category_url" value="{$vo.category_url}" /><span class="require-field">*</span><br /><span class="notice-span" style="display:block" id="url">{$Think.lang.category_url_note}sample-cat:<br /><code style="background:#DDEEF2;">{&blog_domain}Category/sample-cat/</code><br /><code style="background:#DDEEF2;">{&blog_domain}cat?=123</code></span>
        </td>
      </tr>
      <tr>
        <td class="label">{$Think.lang.category_sort}:</td>
        <td><input type="text" name='category_sort' value="{$vo.category_sort}" size="17" /><span class="require-field">*</span>
        </td>
      </tr>
      <tr>
        <td class="label">{$Think.lang.category_isshow}:</td>
        <td><input type="radio" name="category_isshow" value="1"  <eq name="vo.category_isshow" value="1" >checked="true"</eq>/> {$Think.lang.yes}          
		  <input type="radio" name="category_isshow" value="0" <eq name="vo.category_isshow" value="0" >checked="true"</eq>/> {$Think.lang.no}    
		   </td>
      </tr>
      <tr>
        <td class="label"><a href="javascript:showNotice('seoti');" title="{$Think.lang.notic}"><img src="__PUBLIC__/Images/notice.gif" width="16" height="16" border="0"></a> {$Think.lang.category_seoti}:</td>
        <td>
          <input type="text" name="category_seoti" size="40" value="{$vo.category_seoti}"/> <br />
          <span class="notice-span" style="display:block" id="seoti">{$Think.lang.category_seoti_note}</span>        </td>
      </tr>
      <tr>
        <td class="label"><a href="javascript:showNotice('seokw');" title="{$Think.lang.notic}"><img src="__PUBLIC__/Images/notice.gif" width="16" height="16" border="0"></a> {$Think.lang.category_seokw}:</td>
        <td><input type="text" name="category_seokw" size="50" value="{$vo.category_seokw}"/><br />
          <span class="notice-span" style="display:block" id="seokw">{$Think.lang.category_seokw_note}</span>        </td>
      </tr>
      <tr>
        <td class="label"><a href="javascript:showNotice('seodesc');" title="{$Think.lang.notic}"><img src="__PUBLIC__/Images/notice.gif" width="16" height="16" border="0"></a> {$Think.lang.category_seodesc}:</td>
        <td>
          <textarea name="category_seodesc" rows="6" cols="48">{$vo.category_seodesc}</textarea><br />
          <span class="notice-span" style="display:block" id="seodesc">{$Think.lang.category_seodesc_note}</span>        </td>
      </tr>
	  <tr>
	  <td colspan="2" class="label">
	  <div class="button-div">
        <input type="submit" value=" {$Think.lang.submit} " class="button"/>
        <input type="reset" value=" {$Think.lang.reset} " class="button"/>
		<input type="hidden" name="act" value="do" />
		<input type="hidden" name="category_id" value="{$vo.category_id}" />
      </div>
	  </td>
	  </tr>
      </table> 
  </form>
</div>
<!-- end add new category form -->
<include file="Public:pagefooter"/> 